package com.moxiao.yfjh.module.activity.dal.mysql.packageType;

import java.util.*;

import com.moxiao.yfjh.framework.common.pojo.PageResult;
import com.moxiao.yfjh.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.moxiao.yfjh.framework.mybatis.core.mapper.BaseMapperX;
import com.moxiao.yfjh.module.activity.dal.dataobject.packageType.PackageTypeDO;
import org.apache.ibatis.annotations.Mapper;
import com.moxiao.yfjh.module.activity.controller.admin.packageType.vo.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 相亲套餐类型 Mapper
 *
 * @author mx
 */
@Mapper
public interface PackageTypeMapper extends BaseMapperX<PackageTypeDO> {

    default PageResult<PackageTypeDO> selectPage(PackageTypePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PackageTypeDO>()
                .eqIfPresent(PackageTypeDO::getNo, reqVO.getNo())
                .likeIfPresent(PackageTypeDO::getName, reqVO.getName())
                .eqIfPresent(PackageTypeDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(PackageTypeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PackageTypeDO::getId));
    }

    default List<PackageTypeDO> selectList(PackageTypeExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<PackageTypeDO>()
                .eqIfPresent(PackageTypeDO::getNo, reqVO.getNo())
                .likeIfPresent(PackageTypeDO::getName, reqVO.getName())
                .eqIfPresent(PackageTypeDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(PackageTypeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PackageTypeDO::getId));
    }

    @Select("select count(*) num from blind_package_type where no = #{packageTypeNo}")
    Integer getPackageTypeNo(@Param("packageTypeNo") String packageTypeNo);

}
